#include <stdio.h>
//结构体指针
struct student{
    int num;
    char name[20];
    char sex;
};
int main() {
    struct student s={1001,"wangle",'M'};
    struct student sarr[3]={1001,"lilei",'M',1005,"zhangsan",'M',1007,"lili",'F'};
    struct student *p; //定义结构体指针
    int num;
    p=&s;
    printf("%d %s %c\n",p->num,p->name,p->sex);
    p=sarr;
    printf("%d %s %c\n",(*p).num,(*p).name,(*p).sex); //方式一获取成员
    printf("%d %s %c\n",p->num,p->name,p->sex); //方式二获取成员
    printf("------------------------------\n");
    p=p+1;
    printf("%d %s %c\n",p->num,p->name,p->sex);
    return 0;
}
